From: Stefan Monnier Date: Sat, 28 Mar 2009 02:06:06 +0000 (+0000) Subject: (Finsert_file_contents): Don't limit size to INT_MAX/4. X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~421^2~1062 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=ab54c0096c1a5b0b98f69195083512bfdc5038f3;p=emacs.git (Finsert_file_contents): Don't limit size to INT_MAX/4. --- diff --git a/src/ChangeLog b/src/ChangeLog index 98422c6cd2a..cf02d66f09d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2009-03-28 Stefan Monnier + + * fileio.c (Finsert_file_contents): Don't limit size to INT_MAX/4. + 2009-03-27 Jan Djärv * frame.c (x_set_font): If the fullscreen property is non-nil, adjust diff --git a/src/fileio.c b/src/fileio.c index 4f3573b02d7..93b6a1d8298 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3300,7 +3300,11 @@ variable `last-coding-system-used' to the coding system actually used. */) overflow. The calculations below double the file size twice, so check that it can be multiplied by 4 safely. */ if (XINT (end) != st.st_size - || st.st_size > INT_MAX / 4) + /* Actually, it should test either INT_MAX or LONG_MAX + depending on which one is used for EMACS_INT. But in + any case, in practice, this test is redundant with the + one above. + || st.st_size > INT_MAX / 4 */) error ("Maximum buffer size exceeded"); /* The file size returned from stat may be zero, but data